/*
 * 数据表达
 *
 * 1.数据类型
 *
 * 1.1 基本数据类型
 * 1.1.1 数字
 * 1.1.1.1 整形:(unsigned) int, (unsigned) short int, (unsigned) long int, 
 * 1.1.1.2 实数:(unsigned) float,(unsigned) doubule
 * 1.1.2 字符
 * 1.1.2.1 字符:a-z,A-Z,转义字符，特殊符号
 * 1.1.2.2 字符串
 *
 * 1.2 扩展数据类型
 * 1.2.1 枚举
 * 1.2.2 数组
 * 1.2.3 二维数组
 * 1.2.4 结构体
 * 1.2.5 共同体
 *
 * 1.3 指针类型
 * 指针系列参照../Point/point.c
 * 本部分只涉及指针在数据表达中的应用
 * 1.3.1 指针在数据表达中的应用
 * 1.3.1.1 量的指针
 * 1.3.1.2 数据类型的指针
 * 1.3.1.2.1 基本数据类型指针
 * 1.3.1.2.2 扩展数据类型指针
 * 1.3.1.3 指针的指针
 * 1.3.1.4 空指针
 *
 * 1.3.2 指针在控制结构中的应用
 * 1.3.2.1 函数指针
 *
 * 1.3.3 指针正在基本应用中的应用
 * 1.3.3.1 文件指针
 *
 * 1.4 空类型void
 *
 * 2.运算符
 * 2.1 赋值运算
 * 2.2 算数运算
 * 2.3 逻辑运算
 * 2.4 关系运算
 *
 * 
 * 3.表达式
 * 3.1 运算表达式
 * 3.2 条件表达式
 *
 * 4.返回值
 * 4.1 数据类型返回
 * 4.2 布尔类型返回
 */

#include<stdio.h>
#include<limits.h>
#include<float.h>

int main(){
	//各个数据类型存储字节.
	//*扩展数据类型也可以通过sizeof函数获取存储字节数
	printf("sizeof(char):%d\n",sizeof(char));
	printf("sizeof(short):%d\n",sizeof(short));
	printf("sizeof(int):%d\n",sizeof(int));
	printf("sizeof(float):%d\n",sizeof(float));
	printf("sizeof(float):%d\n",sizeof(double));
	printf("sizeof(long):%d\n",sizeof(long));
	//数字型
		//各数字数据类型最值
	printf("unsigned char max is:%d\n",UCHAR_MAX);
	printf("char max is:%d,min is:%d\n",CHAR_MAX,CHAR_MIN);
	printf("unsigned short int max is:%d\n",USHRT_MAX);
	printf("short int max is:%d,min is:%d\n",SHRT_MAX,SHRT_MIN);
	printf("unsigned int max is:%ld\n",UINT_MAX);
	printf("int max is:%d,min is:%d\n",INT_MAX,INT_MIN);
	printf("unsigned long int max is:%lu\n",ULONG_MAX);
	printf("long int max is:%ld,min is:%ld\n",LONG_MAX,LONG_MIN);
	//printf("float max is:%f,min is:%f\n",FLT_MAX,FLT_MIN);
	printf("float max is:%e,min is:%e\n",FLT_MAX,FLT_MIN);
	//printf("double max is:%f,min is:%f\n",DBL_MAX,DBL_MIN);
	printf("double max is:%e,min is:%e\n",DBL_MAX,DBL_MIN);
	//字符型
		//字符类型
	//printf("%c %c,%c %c\n",'(',')','*','%');
	//printf("%d %d,%d %d\n",'(',')','*','%');
	int i = 0;
	for ( i = 32; i < 127; i++ )
		printf("%d is :%c\n",i,i);
		//字符串类型
	char *string_var_001 = "Hello,world.My name is liwanliang.I am learning C program now.";
	printf("%s\n",string_var_001);

	/*
	 * 1.2 扩展数据类型*
	*/

	/*1.2.1 枚举类型*/
	//枚举类型定义
	enum DAY
	{
		MON=10,TUE,WED,THU,FRI,SAT,SUN
	};
	//枚举类型变量声明
	enum DAY today;
	//枚举类型变量赋值
	today = TUE;
	printf("enum today is :%d\n",today);
	

	/*1.2.2 数组*/
	//数字型一维数组
	int int_array_001[] = {1,2,3,4};
	int i_001 = 0;
	for ( i_001 = 0; i_001 < sizeof(int_array_001) / sizeof(int); i_001++ )
		printf("int_array_001[%d]:%d  ",i_001,int_array_001[i_001]);
	printf("\n");
			
	//字符型一维数组
	char char_array_001[] = {'h','e','l','l','o'};
	int i_002 = 0;
	for ( i_002 = 0; i_002 < sizeof(char_array_001) / sizeof(char); i_002++ )
		printf("char_array_001[%d]:%c  ",i_002,char_array_001[i_002]);
	printf("\n");

	//字符串一维数组
	char *string_array_001[] = {"my","name","is","li wan liang"};
	int i_003 = 0;
	for ( i_003 = 0; i_003 < 4; i_003++ )
		printf("string_array_001[%d]:%s  ",i_003,string_array_001[i_003]);
	printf("\n");

	/*1.2.3 二维数组*/
	//数字型二维数组
	int int_array_002[2][2] = {{1,2},{11,12}};
	int i_004_i,i_004_j = 0;
	for ( i_004_j = 0; i_004_j < 2; i_004_j++ )
	{
		for ( i_004_i = 0; i_004_i < 2; i_004_i++ )
			printf("int_array_002[%d][%d]:%d  ",i_004_j,i_004_i,int_array_002[i_004_j][i_004_i]);
	}
	printf("\n");

	//字符型二维数组
	char char_array_002[2][2] = {{'A','B'},{'C','D'}};
	int i_005_i,i_005_j = 0;
	for ( i_005_j = 0; i_005_j < 2; i_005_j++ )
	{
		for ( i_005_i = 0; i_005_i < 2; i_005_i++ )
			printf("char_array_002[%d][%d]:%c  ",i_005_j,i_005_i,char_array_002[i_005_j][i_005_i]);
	}
	printf("\n");
	//字符串型二维数组
	char *string_array_002[2][2] = {{"my","name"},{"is","li wan liang"}};
	int i_006_i,i_006_j = 0;
	for ( i_006_j = 0; i_006_j < 2; i_006_j++ )
	{
		for ( i_006_i =0; i_006_i < 2; i_006_i++ )
			printf("string_array_002[%d][%d]:%s  ",i_006_j,i_006_i,string_array_002[i_006_j][i_006_i]);
	}
	printf("\n");

	/*1.2.3 结构体*/
	//结构体定义
	struct liwl{
		int  age; //年龄
		char sex; //性别
		char *name; //名字
		char *language[6];	//学习的语言
	};
	//结构体变量声明及赋初值
	struct liwl liwl01 = { 28,'M',"li wan liang",{"C","Shell","Python","Go","Php","Java"} };
	printf("Hello,my name is %s.I am is a %c.And I'm %d years old.\n",liwl01.name,liwl01.sex,liwl01.age);
	printf("I just start to learn ");
	int i_007 = 0;
	for ( i_007 = 0; i_007 < 6; i_007++ )
		printf("%s ",liwl01.language[i_007]);
	printf("\n");

	//结构体数组
	struct liwl liwl02[2] = {
		{28,'M',"liwl01",{"C","Shell","Python","Go","Php","Java"}},
		{29,'M',"liwl02",{"Ruby","R","Lua","JavaScript","Tcl","HTML"}},
	};
	int i_008 = 0;
	for ( i_008 =0; i_008 < 2; i_008++ )
	{
		printf("My name is:%s,I am is a %c.This year I am %d old.And I want to learn ",
				liwl02[i_008].name,liwl02[i_008].sex,liwl02[i_008].age);
		int i_009 = 0;
		for ( i_009 = 0; i_009 < 6; i_009++ )
			printf("%s ",liwl02[i_008].language[i_009]);
		printf("\n");
	}

	/*1.2.4 共同体*/

	return 0;
}
